package com.csk.zsk.compents.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.csk.zsk.commons.dao.impl.BaseHibernateDao;
import com.csk.zsk.compents.dao.CommentDao;
import com.csk.zsk.compents.entity.Comment;
import com.csk.zsk.compents.entity.Picnews;

@Repository
public class CommentDaoImpl extends BaseHibernateDao<Comment, String> implements CommentDao {

	@Override
	public List<Comment> getSubCommentListById(String commentid) {
		return this.findBy("commentid", commentid);
	}

	@Override
	public List<Comment> getCommentListByOjbid(String objid, boolean hasSub) {
		String sql = "";
		if(hasSub){
			sql = "from Comment comment where comment.objid=? order by createtime desc";
		}else{
			sql = "from Comment comment where comment.objid=? and commentid is null order by createtime desc";
			
		}
		
		return this.find(sql, objid);
		
	}

}
